package leetcode.code2099;

import java.util.Arrays;

import leetcode.IDebug;

public class Solution implements IDebug {

	public int[] maxSubsequence(int[] nums, int k) {
		int len = nums.length;
		int[][] arr = new int[len][2];
		for (int i = 0; i < len; i++) {
			arr[i][0] = nums[i];
			arr[i][1] = i;
		}
		Arrays.sort(arr, (a, b) -> b[0] - a[0]);
		int[][] maxk = new int[k][2];
		for (int i = 0; i < k; i++) {
			maxk[i][0] = arr[i][0];
			maxk[i][1] = arr[i][1];
		}
		Arrays.sort(maxk, (a, b) -> a[1] - b[1]);
		int[] ans = new int[k];
		for (int i = 0; i < k; i++) {
			ans[i] = maxk[i][0];
		}
		return ans;
	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
